package com.ckk.cloud.feign.controller;

import com.ckk.apicommoncloud.entity.CommonResult;
import com.ckk.apicommoncloud.entity.Payment;
import com.ckk.cloud.feign.config.FeiginClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 陈昆昆
 * @version 1.0
 * @date 2020/6/16 14:26
 */
@RestController
public class FeignController {

    @Autowired
    private FeiginClients feiginClients;

    @GetMapping(value="/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return  feiginClients.getPaymentById(id);
    }


    @PostMapping("payment/create")
    public CommonResult create(@RequestBody Payment payment){
        return feiginClients.create(payment);
    }

    @GetMapping(value = "payment/get/timeout")
    public String outTime(){
        try {
            Thread.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        String str = feiginClients.outTime();
        return str;
    }
}
